# Run this test from the root of build directory.

set -e

# Update build:
make
# Run lint checker:
SOURCE_FILTER=-legal/copyright,-build/header_guard,-build/include
CPPLINT=third_party/cpplint/cpplint.py
SCRIPT_DIR=`cd $(dirname "$0") && pwd`
SOURCE_DIR=${SCRIPT_DIR}/..
echo "Running lint on sources in ${SOURCE_DIR}"
(cd ${SOURCE_DIR} && $CPPLINT --filter=${SOURCE_FILTER} \
  include/grate/*.h \
  include/grate/*/*.h \
  lib/*/*.{h,cc} \
  projects/binary_patterns/*.{h,cc} \
  projects/sample/*.cc \
  test/include/*.h \
  test/*/*.{h,cc} \
  test/projects/*/*.cc
  )

# Run unit tests:
./test/core_test
./test/util_test
./test/binary_patterns_test
